﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <div>
    <el-form ref="formRefEquipmentSpotRecord" :model="stateEquipmentSpotRecord.vmModel" label-width="100px">
      <el-row>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_EquipmentId_FormItem" prop="Entity.EquipmentId" :label="$t('message.autotrans._Model_EquipmentSpotRecord_Equipment')">
            <el-select v-model="stateEquipmentSpotRecord.vmModel.Entity.EquipmentId" disabled clearable>
               <el-option v-for="item in stateEquipmentSpotRecord.AllEquipments" :key="item.Value" :value="item.Value" :label="item.Text"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_SpotTableId_FormItem" prop="Entity.SpotTableId" :label="$t('message.autotrans._Model_EquipmentSpotRecord_SpotTableId')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.SpotTableId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineId_FormItem" prop="Entity.LineId" :label="$t('message.autotrans._Model_EquipmentSpotRecord_LineId')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.LineId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_LineCode_FormItem" prop="Entity.LineCode" :label="$t('message.autotrans._Model_EquipmentSpotRecord_LineCode')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.LineCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpId_FormItem" prop="Entity.OpId" :label="$t('message.autotrans._Model_EquipmentSpotRecord_OpId')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.OpId" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_OpCode_FormItem" prop="Entity.OpCode" :label="$t('message.autotrans._Model_EquipmentSpotRecord_OpCode')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.OpCode" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_SpotType_FormItem" prop="Entity.SpotType" :label="$t('message.autotrans._Model_EquipmentSpotRecord_SpotType')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_EquipmentSpotRecord_SpotType')}), trigger: 'blur' }]" >
            <el-select v-model="stateEquipmentSpotRecord.vmModel.Entity.SpotType" disabled clearable>
               <el-option key="Appearance" value="Appearance" :label="$t('message.autotrans._Enum_SpotTypeEmum_Appearance')"></el-option>
               <el-option key="SafetyDevice" value="SafetyDevice" :label="$t('message.autotrans._Enum_SpotTypeEmum_SafetyDevice')"></el-option>
               <el-option key="DetectionInstrument" value="DetectionInstrument" :label="$t('message.autotrans._Enum_SpotTypeEmum_DetectionInstrument')"></el-option>
               <el-option key="NgMaster" value="NgMaster" :label="$t('message.autotrans._Enum_SpotTypeEmum_NgMaster')"></el-option>
               <el-option key="OkMaster" value="OkMaster" :label="$t('message.autotrans._Enum_SpotTypeEmum_OkMaster')"></el-option>
               <el-option key="ControlSystem" value="ControlSystem" :label="$t('message.autotrans._Enum_SpotTypeEmum_ControlSystem')"></el-option>
               <el-option key="CoolSystem" value="CoolSystem" :label="$t('message.autotrans._Enum_SpotTypeEmum_CoolSystem')"></el-option>
               <el-option key="MaintenanceStatus" value="MaintenanceStatus" :label="$t('message.autotrans._Enum_SpotTypeEmum_MaintenanceStatus')"></el-option>
               <el-option key="MaintenanceRecords" value="MaintenanceRecords" :label="$t('message.autotrans._Enum_SpotTypeEmum_MaintenanceRecords')"></el-option>
               <el-option key="LeakageProtection" value="LeakageProtection" :label="$t('message.autotrans._Enum_SpotTypeEmum_LeakageProtection')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Content_FormItem" prop="Entity.Content" :label="$t('message.autotrans._Model_EquipmentSpotRecord_Content')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_EquipmentSpotRecord_Content')}), trigger: 'blur' }]" >
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.Content" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_Status_FormItem" prop="Entity.Status" :label="$t('message.autotrans._Model_EquipmentSpotRecord_Status')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_EquipmentSpotRecord_Status')}), trigger: 'blur' }]" >
            <el-select v-model="stateEquipmentSpotRecord.vmModel.Entity.Status" disabled clearable>
               <el-option key="Done" value="Done" :label="$t('message.autotrans._Enum_SpotStatuEnum_Done')"></el-option>
               <el-option key="Ok" value="Ok" :label="$t('message.autotrans._Enum_SpotStatuEnum_Ok')"></el-option>
               <el-option key="Ng" value="Ng" :label="$t('message.autotrans._Enum_SpotStatuEnum_Ng')"></el-option>
               <el-option key="WaitMaintenance" value="WaitMaintenance" :label="$t('message.autotrans._Enum_SpotStatuEnum_WaitMaintenance')"></el-option>
               <el-option key="WaitRepair" value="WaitRepair" :label="$t('message.autotrans._Enum_SpotStatuEnum_WaitRepair')"></el-option>
            </el-select>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UseOperator_FormItem" prop="Entity.UseOperator" :label="$t('message.autotrans._Model_EquipmentSpotRecord_UseOperator')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.UseOperator" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreateTime_FormItem" prop="Entity.CreateTime" :label="$t('message.autotrans._Model_EquipmentSpotRecord_CreateTime')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.CreateTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UpdateTime_FormItem" prop="Entity.UpdateTime" :label="$t('message.autotrans._Model_EquipmentSpotRecord_UpdateTime')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.UpdateTime" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_CreateBy_FormItem" prop="Entity.CreateBy" :label="$t('message.autotrans._Model_EquipmentSpotRecord_CreateBy')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.CreateBy" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_UpdateBy_FormItem" prop="Entity.UpdateBy" :label="$t('message.autotrans._Model_EquipmentSpotRecord_UpdateBy')">
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.UpdateBy" disabled clearable></el-input>
        </el-form-item>

        </el-col>
        <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_IsValid_FormItem" prop="Entity.IsValid" :label="$t('message.autotrans._Model_EquipmentSpotRecord_IsValid')"            :rules="[{required: true, message: $t('message._system.common.vm.input',{input:$t('message.autotrans._Model_EquipmentSpotRecord_IsValid')}), trigger: 'blur' }]" >
            <el-input v-model="stateEquipmentSpotRecord.vmModel.Entity.IsValid" disabled clearable></el-input>
        </el-form-item>

        </el-col>
      </el-row>

      <div style="text-align:right;">
        <WtmButton @click="onCloseEquipmentSpotRecord"  type="primary" :button-text="$t('message.autotrans.SysClose')" style="margin-top:15px;"/>

      </div>

    </el-form>

  </div>

</el-card>
</div>
</template>


<script setup lang="ts" name="message.autotrans._PageEquipmentManagementEquipmentSpotRecordDetails;false">
import {  ElMessageBox, ElMessage,ElLoading } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { equipmentspotrecordApi } from '/@/api/equipmentmanagement/equipmentspotrecord';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;


// 定义变量内容
const formRefEquipmentSpotRecord = ref();
const stateEquipmentSpotRecord = reactive({
    vmModel: {
	  Entity:{
        EquipmentId: null,
        SpotTableId: null,
        LineId: null,
        LineCode: '',
        OpId: null,
        OpCode: '',
        SpotType: undefined,
        Content: '',
        Status: undefined,
        UseOperator: '',
        CreateTime: undefined,
        UpdateTime: undefined,
        CreateBy: '',
        UpdateBy: '',
        IsValid: undefined,
        ID:null,
      },

	},
    
    AllEquipments: [] as any[],
});

// 取消
const onCloseEquipmentSpotRecord = () => {
    closeDialog();
};

// 提交
const onSubmitEquipmentSpotRecord = () => {
 	const loadingInstance = ElLoading.service({
		lock: true,
		text: '正在提交中，请等待。。。',
		background: 'rgba(0, 0, 0, 0.7)',
	});
   formRefEquipmentSpotRecord.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            equipmentspotrecordApi().edit(stateEquipmentSpotRecord.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            }).finally(() => {
			loadingInstance.close();
		    })
		}
        else{
			loadingInstance.close();
        }
	})
};

// 页面加载时
onMounted(() => {
    
    other.getSelectList('/api/EquipmentManagement/EquipmentSpotRecord/GetEquipments',[],false).then(x=>{stateEquipmentSpotRecord.AllEquipments = x});
    if (ci.attrs["wtmdata"]) {
		stateEquipmentSpotRecord.vmModel.Entity.ID = ci.attrs["wtmdata"].ID;
	}
	else if (useRouter().currentRoute.value.query.id) {
		stateEquipmentSpotRecord.vmModel.Entity.ID = useRouter().currentRoute.value.query.id as any;
	}
	equipmentspotrecordApi().get(stateEquipmentSpotRecord.vmModel.Entity.ID ?? "").then((data: any) => other.setValue(stateEquipmentSpotRecord.vmModel, data));
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

